<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<title>密码修改</title>
		<%@ include file="/common/meta.jsp"%>
		<%@ include file="/common/jquery-ui-inc.jsp"%>
		<script type="text/javascript" src="${ctx}/uct/js/md5.js"></script>
		<script>
	function modPwd() {

	var oldPass = $('#oldPass').val();
	var newPass = $('#newPass').val();
	var newPass2 = $('#newPass2').val();
	
	if(oldPass.length<1){
		$.messager.alert('提示', '请输入旧密码', 'error');
		return ;
	}
	
	if(newPass.length<1){
		$.messager.alert('提示', '请输入新密码', 'error');
		return ;
	}
	if(newPass.indexOf(" ") > -1){
		$.messager.alert('提示', '新密码不能输入空格，请重新输入', 'error');
		return ;
	}
	if(newPass!=newPass2){
		$.messager.alert('提示', '新密码两次输入不一致，请重新输入', 'error');
		return ;
	}
	

	$.ajax( {
		type : "post",
		url : "${ctx}/common/update-pwd.action?submitFlag=T&oldPass=" 
		+ oldPass.md5()+"&newPass="+newPass.md5()+"&newPass2="+newPass2.md5(),
		beforeSend : function(XMLHttpRequest) {
			//ShowLoading();
	},
	success : function(data, textStatus) {
	var result = jQuery.parseJSON(data);
	if(result.isok=='T'){
		$.messager.alert('结果', '操作成功', 'info',function(){
			parent.closePasWin();
		});
	}else{
		$.messager.alert('结果', result.msg, 'error');	
	}
		
	},
	complete : function(XMLHttpRequest, textStatus) {
		//HideLoading();
	},
	error : function() {
		//请求出错处理
	}
	});

}

$(function(){
	$('#oldPass').focus();
	
});
</script>
</head>
<body>	
<div id="tip">
	<table class="datagrid-body" >
	<!-- <table width="100%" border="0" cellpadding="0" cellspacing="0"  style="margin-top:20px" class="infotab"> -->
		<!-- <form id="inputForm" name="inputForm" method="post" action="data-cate-save.action" class="infotab"> -->
			<input type="hidden" name="submitFlag" id="submitFlag" value="T"/>
			<input type="hidden" name="cateId" id="cateId" value="${dataCate.cateId}"/>
			<input type="hidden" name="oldCateEname" id="oldCateEname" value="${dataCate.cateEname}"/>
			
			<tr >
				<td class="datagrid-header">用户账号<font color=red>*</font></td>
				<td>
					<input name="cateEname" id="cateEname" disabled="disabled" value="${loginUser.userEname}"/>
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">用户姓名</td>
				<td>
					<input id="cateRemark" name="cateRemark" disabled="disabled" value="${loginUser.userCname}"
					 />
				</td>
			</tr>			
				<tr>
				<td class="datagrid-header">旧密码</td>
				<td align="left">
						<input id="oldPass" name="oldPass" type="password" value=""
							class="easyui-validatebox" required="true" size="30"
							validType="length[1,30]" missingMessage="旧密码"
							invalidMessage="应为1~30个字" />
					</td>
				
			</tr>
			<tr>
				<td class="datagrid-header">新密码</td>
				<td align="left">
						<input id="newPass" name="newPass" type="password" value=""
							class="easyui-validatebox" required="true" size="30"
							validType="length[0,30]" missingMessage="新密码"
							invalidMessage="不能超过30个字" />
					</td>
				
			</tr>
			<tr>
				<td class="datagrid-header">确认新密码</td>
				<td align="left">
						<input id="newPass2" name="newPass2" type="password" value=""
							class="easyui-validatebox" required="true" size="30"
							validType="length[0,30]" missingMessage="新密码"
							invalidMessage="不能超过30个字" />
					</td>
				
			</tr>
			
			<tr>
				<td class="datagrid-header"></td>
				<td >	
					<a href="#" class="easyui-linkbutton" id="bt1" iconCls="icon-save" onclick="modPwd();">保存</a>
				</td>
			</tr>
			
	</table>
	
</div>
</body>
</html>
